/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.wat.dp.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Krzysiek
 */
@Entity
@Table(name = "typ_wykresu")
@NamedQueries({@NamedQuery(name = "TypWykresu.findAll", query = "SELECT t FROM TypWykresu t"), @NamedQuery(name = "TypWykresu.findById", query = "SELECT t FROM TypWykresu t WHERE t.id = :id"), @NamedQuery(name = "TypWykresu.findByNazwa", query = "SELECT t FROM TypWykresu t WHERE t.nazwa = :nazwa"), @NamedQuery(name = "TypWykresu.findByKategoria", query = "SELECT t FROM TypWykresu t WHERE t.kategoria = :kategoria")})
public class TypWykresu implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nazwa")
    private String nazwa;
    @Basic(optional = false)
    @Column(name = "kategoria")
    private String kategoria;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "typWykresu")
    private Collection<DefWykresu> defWykresuCollection;

    public TypWykresu() {
    }

    public TypWykresu(Integer id) {
        this.id = id;
    }

    public TypWykresu(Integer id, String nazwa, String kategoria) {
        this.id = id;
        this.nazwa = nazwa;
        this.kategoria = kategoria;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNazwa() {
        return nazwa;
    }

    public void setNazwa(String nazwa) {
        this.nazwa = nazwa;
    }

    public String getKategoria() {
        return kategoria;
    }

    public void setKategoria(String kategoria) {
        this.kategoria = kategoria;
    }

    public Collection<DefWykresu> getDefWykresuCollection() {
        return defWykresuCollection;
    }

    public void setDefWykresuCollection(Collection<DefWykresu> defWykresuCollection) {
        this.defWykresuCollection = defWykresuCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TypWykresu)) {
            return false;
        }
        TypWykresu other = (TypWykresu) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pl.wat.dp.entities.TypWykresu[id=" + id + "]";
    }

}
